<?php echo $header;echo $sidebar ?>		
		<div class="span10 content">
			<?php echo $hugemenu ?>

            <h1><?php echo $title; ?></h1>
            <?php if ($message) { ?>
                <div class="alert alert-error">
                    <a class="close" data-dismiss="alert" href="#">x</a><?php echo $message; ?>
                </div>
            <?php } if ($success) { ?>
                <div class="alert alert-success">
                    <a class="close" data-dismiss="alert" href="#">x</a><?php echo $success; ?>
                </div>
            <?php } ?>
            <!--div class="alert alert-info"><?php echo lang('hrm_booking_add_message'); ?></div-->
		

		
		<div class="content">	
	<?php // echo $hugemenu ?> 
                    
      
			<h1><?php echo "Bookings Calendar"; ?></h1> 
                        
            <?php 
			
$mese_testo_ing=array(1 => "January", "February", "March", "April", "May", "June",  "July", "August", "September", "October", "November"," end_timecember");
$giorni_settimana=array("S","M","T","W","T","F","S");
$months=array(1 => "January", "February", "March", "April", "May", "June",  "July", "August", "September", "October", "November"," end_timecember");
	//echo $this->data['content'];		
			
			?>
            <div>   
					<div id='hrm_calendar'>
					<form method="POST" action="<? echo $_SERVER['PHP_SELF']; ?>">
					<CENTER>
					<select name="Mese" size="1">
					  <option value="0">Month</option>
					  <?php
						
						foreach($months as $key => $value)
						{
							echo "<option value='".$key."' >".$value."</option>";
						
						}


					  ?>
					  
					  </select>
					<select name="Anno" size="1">
					  <option selected value="0">Year</option>
					  <?
					  //stampa gli ultimi n ani
					  $anno_inizio=(date("Y")-1);
					  $anno_fine=(date("Y")+1);
					  for ($i = $anno_inizio; $i <= $anno_fine; $i++) {
						echo "<option>$i</option>";
					  }
					  ?>
					</select>
					<input type="submit" value="Ok" name="B1">
					</CENTER>
					</form>
					</div>
					<div class="calendar-box" >
<?php 
echo "Month : ".$months[$Mese]." - Year : ".$Anno;
//$Mese="";
//$Anno="";
//nel caso ancora piglia il mese attuale
	$Mese = (empty($Mese)) ? date("n") : $Mese;
	//Se l'anno non ?resente lo setto a quello corrente
	$Anno = (empty($Anno)) ? date("Y") : $Anno;
	if (($Mese+1)>12)
	{ 
		$M1=1;
		$A1=$Anno+1;
	}
	else 
	{
		$M1=$Mese+1;
		$A1=$Anno;
	}
	
	//echo $A1." - ".$M1; 
	$now = strtotime($Anno."-".$Mese."-01"); //time(); // or your date as well
    $your_date = strtotime("2000-01-01");
    $currentdiff = $now - $your_date;
	
	$nxtdt =strtotime($A1."-".$M1."-01");
	$nxtdiff = $nxtdt - $your_date;
    
	$DD1= floor($currentdiff/(60*60*24));
	$DD2= floor($nxtdiff/(60*60*24));
	
	
	//$DD1=QuantiGiorni("2000-01-01",$Anno."-".$Mese."-01");//Datestart_timeff("d", DataMinima, "01/"&Mese&"/"&Anno)
	//$DD2=QuantiGiorni("2000-01-01",$A1."-".$M1."-01");//Datestart_timeff("d", DataMinima, "01/"&M1&"/"&A1)
	//Date per il link avanti e instart_timeetro
	$A=$Anno;
	if ($Mese==1) 
	{
		$MI=12;$MA=$Mese+1;$AI=$Anno-1;$AA=$Anno;
	} 
	elseif ($Mese==12) 
	{
		$MA=1;$MI=$Mese-1;$AI=$Anno;$AA=$Anno+1;
	}
	else
	{
		$MA=$Mese+1;$MI=$Mese-1;$AI=$Anno;$AA=$Anno;
	}
	 $cicli= (($DD2)-$DD1);


?>


<table  width="100%" border="1" align="center">
<tr><td colspan="<? echo ($cicli+1);?>" align="center">
<a href="<?php echo $_SERVER['PHP_SELF']?>?M=<? echo $MI;?>&A=<? echo $AI ?>">Back</a>
<?php echo "<b>$mese_testo[$Mese] $Anno</b> ";?>
<a href="<?php echo $_SERVER['PHP_SELF']?>?M=<? echo $MA;?>&A=<? echo $AA ?>">Forward</a>
</td></tr>
<tr><td width="20%">Rooms</td>

<?php 
//stampa le date end_timella testata
	for ($i = 1; $i <= $cicli; $i++) 
	{
		$content1 .= "<td>"; 
		//stampa il giorno
		
		//echo date("w",strtotime ($i." $mese_testo_ing[$Mese] $Anno"));
		$giorno=$giorni_settimana[date("w",strtotime ($i." $mese_testo_ing[$Mese] $Anno"))];
		if ($giorno=="D") $giorno="<span style=\"color: rgb(255, 0, 0);\">".$giorno."</span>";
		$content1 .=  $giorno."<br>";
		//echo ($i." $mese_testo_ing[$Mese] $Anno");
		if ($i<10) {$content1 .=  "0".$i;} else {$content1 .=  ($i);} 
		$content1 .=  "</td>";
	}
	echo $content1.$content;





//echo $this->data['content']; ?>

</tr>
</table>
</span>
		</div>
		
		<!--/content-->

<?php echo $footer ?>